<div class="division" style=" padding:3px; margin:0;">
<div class="action-bar"style="padding:3px;">
<span onclick="addRow('select')" class="sysiconBtn addorder"><{t}>添加一个可选项<{/t}></span>
<span onclick="addRow('input')" class="sysiconBtn addorder"><{t}>添加一个单行输入项<{/t}></span>
<span onclick="addRow('text')" class="sysiconBtn addorder"><{t}>添加一个多行输入项<{/t}></span>
</div>

<div class="row finder-head">
   
    <div class="p_label span-3"><{t}>用户购买必填项<{/t}></div>
    <div class="p_type span-3"><{t}>输入类型<{/t}></div>
    <div class="p_options span-5"><{t}>可选值 (用"<{/t}><font color='blue'>,</font><{t}>"分隔)<{/t}></div>
  </div>
<div id="minfo_box" class="finder row" style="height:180px;overflow:auto">
<{foreach from=$gtype.minfo item=minfo key=key}>
    <div class="row-line">
        <div class="p_label span-3"><input size="12" name="gtype[minfo][<{$key}>][label]"  value='<{$minfo.label}>' /><input type='hidden' name="gtype[minfo][<{$key}>][name]"  value='<{$minfo.name}>' /></div>
        <div class="p_type span-3">
            <select name="gtype[minfo][<{$key}>][type]">
                <option value="input" <{if $minfo.type == 'input'}>selected<{/if}>><{t}>单行输入项<{/t}></option>
                <option value="text" <{if $minfo.type == 'text'}>selected<{/if}>><{t}>多行输入项<{/t}></option>
                <option value="select" <{if $minfo.type == 'select'}>selected<{/if}>><{t}>选择项<{/t}></option>
            </select>
        </div>
        <div class="p_options span-5"><input name="gtype[minfo][<{$key}>][options]" value='<{if $minfo.options}><{$minfo.options|implode:','}><{/if}>'/></div>
        <div class="p_btn span-1" style=" text-align:center;color:red;" onclick="this.parentNode.parentNode.removeChild(this.parentNode)"><{img title="删除" alt="删除"  src="bundle/delecate.gif" app='desktop'}></div>
        </div>
<{/foreach}>
</div>
</div>

<script language="javascript">

var MINFOTMP = '<div class="row-line"><div class="p_label span-3"><input size="12" name="gtype[minfo][{key}][label]"  /></div><div class="p_name span-3" style="display:none"><input size="12" name="gtype[minfo][{key}][name]"  /></div><div class="p_type span-3"><select name="gtype[minfo][{key}][type]"><option value="input"><{t}>单行输入项<{/t}></option><option value="text"><{t}>多行输入项<{/t}></option><option value="select"><{t}>选择项<{/t}></option></select></div><div class="p_options span-5"><input name="gtype[minfo][{key}][options]"  /></div><div class="p_btn span-1" style=" text-align:center;color:red;" onclick="this.parentNode.parentNode.removeChild(this.parentNode)"><{img title="删除" alt="删除"  src="bundle/delecate.gif"}></div></div>';
var minfoItem = 0;
function addRow(isSel){
    var minfo = new Element('div').set('html',MINFOTMP.substitute({'key':'new_'+(minfoItem++)})).getFirst();
    $('minfo_box').adopt(minfo);
    minfo.getElements('select[name^=gtype[minfo] option').each(function(e){
        if(e.get('value') == isSel)e.set('selected','selected');
    });


}
</script>
